const request = require('../../utils/request.js');

class Controllers { 
    // 用户登陆
    login(params) {
        return request.get(`/index.php?m=api&c=v1.Api&a=users_login&_ajax=1`, params, false,"POST").then(res => res.data)
    }
    // 上传图片
    picture(params) {
        return request.get(`/upload/picture`, params, false,"POST").then(res => res.data)
    }
    banner(params) {
        return request.get('/index.php?m=api&c=v1.Api&a=index&_ajax=1', params, true, "POST").then(res => res.data)
    }
    case(params) {
        return request.get('/index.php?m=api&c=v1.Api&a=index&_ajax=1', params, true, "POST").then(res => res.data)
    }
    collectList(params) {
        return request.get('/index.php?m=api&c=v1.Users&a=get_collect_list&_ajax=1', params, true, "POST").then(res => res.data)
    }
    collect(params) {
        return request.get('/index.php?m=api&c=v1.Users&a=get_collect&_ajax=1', params, true, "POST").then(res => res.data)
    }
    sub(params) {
        return request.get('/index.php?m=api&c=v1.Users&a=get_subscribe&_ajax=1', params, true, "POST").then(res => res.data)
    }
    subList(params) {
        return request.get('/index.php?m=api&c=v1.Users&a=get_subscribe_list&_ajax=1', params, true, "POST").then(res => res.data)
    }

    foot(params) {
        return request.get('/index.php?m=api&c=v1.Users&a=get_foot&_ajax=1', params, true, "POST").then(res => res.data)
    }
    footList(params) {
        return request.get('/index.php?m=api&c=v1.Users&a=get_foot_list&_ajax=1', params, true, "POST").then(res => res.data)
    }
    detail(params) {
        return request.get('/index.php?m=api&c=v1.Api&a=archivesView&_ajax=1', params, true, "POST").then(res => res.data)
    }
    updateUserInfo(params) {
        return request.get('/index.php?m=api&c=v1.Users&a=save_user_info&_ajax=1', params, true, "POST").then(res => res.data)
    }
}

const controllers = new Controllers()
/**
 * 暴露对象，无需每次都加函数名
 */
module.exports = {
    controller: controllers,
    baseUrl:request.url
}